-
Notifications
You must be signed in to change notification settings - Fork 11.6k
context : allow cache-less context for embeddings #13108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ggml-ci
ggml-ci
ggml-ci
ggml-ci
58115a2
to
7e79a42
Compare
I'll work on rebasing and merging this next - it should be a good improvement for embedding models by reducing the allocated memory during inference. |
@@ -49,7 +49,7 @@ static void batch_decode(llama_context * ctx, llama_batch & batch, float * outpu | |||
} | |||
} else if (!llama_model_has_encoder(model) && llama_model_has_decoder(model)) { | |||
// decoder-only model | |||
if (llama_decode(ctx, batch) < 0) { | |||
if (llama_encode(ctx, batch) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, needs a bit of work.
One of the main changes in this PR is that we will start using llama_encode()
when computing embeddings and this change is part of the tests that I did.
target #12799
There is no need to create a KV cache when using embeddings-only models such as BERT.